package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qf.mapper.ProductCommentsMapper;
import com.qf.pojo.ProductComments;
import com.qf.service.ProductCommentsService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author 87380
 * @date 2021/12/3
 */
@Service
public class ProductCommentsServiceImpl implements ProductCommentsService {

    @Resource
    private ProductCommentsMapper productCommentsMapper;
    @Override
    public Page<ProductComments> commentsById(Integer id,Integer pageNum,Integer pageSize) {
        QueryWrapper<ProductComments> wrapper = new QueryWrapper<>();
        wrapper.eq("product_id",id);
        Page<ProductComments> page = new Page<>(pageNum, pageSize);

        return productCommentsMapper.selectPage(page,wrapper);
    }
}
